﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TCDL.GLOBAL;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace TCDL.DAO
{
    class Process
    {
        public static Object HienThi(String strProc, gConnect[] gCon, int iCount, int iType) {
            DataService dservice = new DataService();
            dservice.Connect();
            Object obj = null;
            try
            {
                SqlParameter[] parameters = new SqlParameter[iCount];
                for (int i = 0; i < iCount; i++)
                {
                    parameters[i] = new SqlParameter(gCon[i].Str, gCon[i].Obj);
                }
                
                if (iType == 1)
                {
                    obj = dservice.ExcuteProcedureGetTable(strProc, parameters, null);
                    return obj;
                }
                if (iType == 2)
                {
                    dservice.ExcuteProcedure(strProc, parameters, null);
                    dservice.Disconnect();
                    return 2;
                }
            }
            catch (Exception ex)
            {
                return null;
            }
            return null;
        }
    }
}